﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.MapNotificationTypes.TraitChangedMapNotification
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System.Collections.Generic;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.Core;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.MapNotificationTypes
{
  public class TraitChangedMapNotification : InformationData
  {
    internal static void AutoGeneratedStaticCollectObjectsTraitChangedMapNotification(
      object o,
      List<object> collectedObjects)
    {
      ((InformationData) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      base.AutoGeneratedInstanceCollectObjects(collectedObjects);
      collectedObjects.Add((object) this.Trait);
    }

    internal static object AutoGeneratedGetMemberValueTrait(object o)
    {
      return (object) ((TraitChangedMapNotification) o).Trait;
    }

    internal static object AutoGeneratedGetMemberValueGained(object o)
    {
      return (object) ((TraitChangedMapNotification) o).Gained;
    }

    internal static object AutoGeneratedGetMemberValuePreviousTraitLevel(object o)
    {
      return (object) ((TraitChangedMapNotification) o).PreviousTraitLevel;
    }

    internal static object AutoGeneratedGetMemberValueCurrentTraitLevel(object o)
    {
      return (object) ((TraitChangedMapNotification) o).CurrentTraitLevel;
    }

    public override TextObject TitleText
    {
      get
      {
        return !this.Gained ? new TextObject("{=UT211jbX}Trait Lost") : new TextObject("{=kbaA7aC8}Trait Gained");
      }
    }

    public override string SoundEventPath => "event:/ui/notification/trait_change";

    [SaveableProperty(1)]
    public TraitObject Trait { get; private set; }

    [SaveableProperty(2)]
    public bool Gained { get; private set; }

    [SaveableProperty(3)]
    public int PreviousTraitLevel { get; private set; }

    [SaveableProperty(4)]
    public int CurrentTraitLevel { get; private set; }

    public TraitChangedMapNotification(
      TraitObject trait,
      bool gained,
      int previousLevel,
      TextObject descriptionText)
      : base(descriptionText)
    {
      this.CurrentTraitLevel = Hero.MainHero.GetTraitLevel(trait);
      this.Gained = gained;
      this.Trait = trait;
      this.PreviousTraitLevel = previousLevel;
    }
  }
}
